import type { MenuForm } from './types'
import request from '@/axios'

const pathPrefix = '/api/menu'

export const add = (data: MenuForm): Promise<ApiResult> => {
    return request.post({
        url: `${pathPrefix}`,
        data
    })
}

export const get = (id: string): Promise<MenuForm> => {
    return request.get({
        url: `${pathPrefix}/${id}`
    })
}

export const edit = (id: string, data: MenuForm): Promise<ApiResult> => {
    return request.put({
        url: `${pathPrefix}/${id}`,
        data
    })
}

export const remove = (id: string): Promise<ApiResult> => {
    return request.delete({
        url: `${pathPrefix}/${id}`
    })
}
